import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;

public class Account extends JFrame {

	private String email;
	private String password;
	private Dimension screenDim;

	private Container cp;
	private JLabel labelEmail;
	private JLabel labelPass;
	private JButton buttonOk;

	private JPanel panelEastMail;
	private JPanel panelWestMail;
	private JPanel panelEastPass;
	private JPanel panelWestPass;
	private JPanel panelSouth;
	private JPanel panelTest;

	private JTextField textEmail;
	private JPasswordField textPass;

	public Account(final String e, final String p) {
		email = e;
		password = p;

		cp = getContentPane();
		cp.setLayout(new BorderLayout());
		makeObject();
		arrangeComponents();
		addListener();

		this.setSize(new Dimension(ConstAccount.WIDTH_WINDOW,
				ConstAccount.HEIGHT_WINDOW));

		screenDim = Toolkit.getDefaultToolkit().getScreenSize();
		this.setLocation(
				(int) (screenDim.getWidth() - ConstAccount.WIDTH_WINDOW) / 2,
				(int) (screenDim.getHeight() - ConstAccount.HEIGHT_WINDOW) / 2);

		this.setUndecorated(false);
		this.setVisible(true);

	}

	JTextField getTextEmail() {
		return textEmail;
	}

	JPasswordField getTextPass() {
		return textPass;
	}

	private void addListener() {
		buttonOk.addActionListener(new ClickButtonOk(this));

	}

	private void arrangeComponents() {
		panelSouth.add(buttonOk);
		panelTest.add(textEmail);
		panelTest.add(textPass);
		cp.add(panelSouth, BorderLayout.SOUTH);
		cp.add(panelTest, BorderLayout.CENTER);
	}

	private void makeObject() {
		panelTest = new JPanel(new GridLayout(ConstAccount.TAM_GRIDLAYOUT_NROW,
				ConstAccount.TAM_GRIDLAYOUT_NCOL));
		panelEastMail = new JPanel(new BorderLayout());
		textEmail = new JTextField("exemplo@gmail.com",
				ConstAccount.TAM_TEXTBOX);
		textEmail.setBorder(BorderFactory.createTitledBorder("Email"));
		textPass = new JPasswordField("Input Password",
				ConstAccount.TAM_TEXTBOX);
		textPass.setBorder(BorderFactory.createTitledBorder("Password")); //new Font("Tahoma", Font.ITALIC, 18).toString())
		panelWestMail = new JPanel(new BorderLayout());
		labelEmail = new JLabel("Email:");
		labelPass = new JLabel("Password:");

		panelSouth = new JPanel(new FlowLayout(FlowLayout.RIGHT));
		buttonOk = new JButton("OK");

	}

}
